//
//  LZSResultCell.m
//  IOSProject
//
//  Created by Mac on 2018/4/22.
//  Copyright © 2018年 com.linzhisheng. All rights reserved.
//

#import "LZSResultCell.h"

@interface LZSResultCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *numLabel;
@property (nonatomic, strong) UILabel *amountLabel;
@property (nonatomic, strong) UILabel *requireLabel;
@end

@implementation LZSResultCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UILabel *prizeNameLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"奖项名称" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:prizeNameLabel];
        [prizeNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(15);
            make.left.equalTo(self.contentView.mas_left).mas_offset(15);
        }];
        
        self.nameLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"一等奖" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:self.nameLabel];
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(15);
            make.left.equalTo(prizeNameLabel.mas_right).mas_offset(15);
            make.bottom.equalTo(prizeNameLabel.mas_bottom);
        }];
        
        UILabel *prizeNumLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"中奖数量" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:prizeNumLabel];
        [prizeNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeNameLabel.mas_top).mas_offset(0);
            make.left.equalTo(self.contentView.mas_centerX).mas_offset(0);
        }];

        self.numLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"7" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:self.numLabel];
        [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeNumLabel.mas_top).mas_offset(0);
            make.left.equalTo(prizeNumLabel.mas_right).mas_offset(15);
        }];

        UILabel *prizeAmountLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"中奖金额" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:prizeAmountLabel];
        [prizeAmountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeNameLabel.mas_bottom).mas_offset(15);
            make.left.equalTo(self.contentView.mas_left).mas_offset(15);
            make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-15);
        }];

        self.amountLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"7,676,997" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:self.amountLabel];
        [self.amountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeAmountLabel.mas_top).mas_offset(0);
            make.left.equalTo(prizeAmountLabel.mas_right).mas_offset(15);
        }];
        
        UILabel *prizeRequireLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"中奖条件" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:prizeRequireLabel];
        [prizeRequireLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeNameLabel.mas_bottom).mas_offset(15);
            make.left.equalTo(self.contentView.mas_centerX).mas_offset(0);
        }];
        
        self.requireLabel = [self setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"6+1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:self.requireLabel];
        [self.requireLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(prizeRequireLabel.mas_top).mas_offset(0);
            make.left.equalTo(prizeRequireLabel.mas_right).mas_offset(15);
        }];
    }
    return self;
}

-(void)setModel:(LzsResultLotteryPrizeModel *)model{
    _model = model;
    self.nameLabel.text = model.prize_name;
    self.numLabel.text = model.prize_num;
    self.amountLabel.text = model.prize_amount;
    self.requireLabel.text = model.prize_require;
}

-(void)setQueryModel:(LzsCaipiaoQueryPrizeModel *)queryModel{
    _queryModel = queryModel;
    
    self.nameLabel.text = queryModel.prizename;
    self.numLabel.text = queryModel.num;
    self.amountLabel.text = queryModel.singlebonus;
    self.requireLabel.text = queryModel.require;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
